ListItemRenderer

Kind of class:class
Inherits from:Button < UIComponent < MovieClip
Classpath:gfx.controls.ListItemRenderer
File last modified:Wednesday, 30 June 2010, 09:09:04
The ListItemRenderer derives from the CLIK Button class and extends it to include list-related properties that are useful for its container components. However, it is not designed to be a standalone component, instead it is only used in conjunction with the ScrollingList, TileList and DropdownMenu components.


Inspectable Properties
Since the ListItemRenderer’s are controlled by a container component and never configured manually by a user, they contain only a small subset of the inspectable properties of the Button.
  • label: Sets the label of the ListItemRenderer.
  • visible: Hides the button if set to false.
  • disabled: Disables the button if set to true.
  • enableInitCallback: If set to true, _global.CLIK_loadCallback() will be fired when a component is loaded and _global.CLIK_unloadCallback will be called when the component is unloaded. These methods receive the instance name, target path, and a reference the component as parameters. _global.CLIK_loadCallback and _global.CLIK_unloadCallback should be overriden from the game engine using GFx FunctionObjects.
  • soundMap: Mapping between events and sound process. When an event is fired, the associated sound process will be fired via _global.gfxProcessSound, which should be overriden from the game engine using GFx FunctionObjects.
  • States
    Since it can be selected inside a container component, the ListItemRenderer requires the selected set of keyframes to denote its selected state. This component’s states include
    • an up or default state.
    • an over state when the mouse cursor is over the component, or when it is focused.
    • a down state when the button is pressed.
    • a disabled state.
    • a selected_up or default state.
    • a selected_over state when the mouse cursor is over the component, or when it is focused.
    • a selected_down state when the button is pressed.
    • a selected_disabled state.
    These are the minimal set of keyframes that should be in a ListItemRenderer. The extended set of states and keyframes supported by the Button component, and consequently the ListItemRenderer component, are described in the Getting Started with CLIK Buttons document.

    Events
    All event callbacks receive a single Object parameter that contains relevant information about the event. The following properties are common to all events.
    • type: The event type.
    • target: The target that generated the event.
    The events generated by the ListItemRenderer component are the same as the Button component. The properties listed next to the event are provided in addition to the common properties.
    • show: The component's visible property has been set to true at runtime.
    • hide: The component's visible property has been set to false at runtime.
    • focusIn: The component has received focus.
    • focusOut: The component has lost focus.
    • select: The component's selected property has changed.
      • selected: The selected property of the Button. Boolean property.
    • stateChange: The button's state has changed.
      • state: The Button's new state. String type, Values "up", "over", "down", etc.
    • rollOver: The mouse cursor has rolled over the button.
      • controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3.
    • rollOut: The mouse cursor has rolled out of the button.
      • controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3. /li>
    • press: The button has been pressed.
      • controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3.
    • doubleClick: The button has been double clicked. Only fired when the Button.doubleClickEnabled property is set.
      • controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3.
    • click: The button has been clicked.
      • controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3.
    • dragOver: The mouse cursor has been dragged over the button (while the left mouse button is pressed).
      • controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3.
    • dragOut: The mouse cursor has been dragged out of the button (while the left mouse button is pressed).
      • controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3.
    • releaseOutside: The mouse cursor has been dragged out of the button and the left mouse button has been released.
      • controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3.
    Component metadata:
      InspectableList
      "disableConstraints"
      "disabled"
      "enableInitCallback"
      "labelID"
      "visible"

      Summary


      Constructor
      Class methods
      Class methods inherited from UIComponent

      Constructor

      ListItemRenderer

      function ListItemRenderer (
      )

      The constructor is called when a ListItemRenderer or a sub-class of ListItemRenderer is instantiated on stage or by using attachMovie() in ActionScript. This component can not be instantiated using new syntax. When creating new components that extend ListItemRenderer, ensure that a super() call is made first in the constructor.

      Instance properties

      index

      index:Number
      (read,write)

      The current index of the data that the itemRenderer contains.

      owner

      owner:CoreList
      (read,write)

      The component instance that owns this renderer.

      selectable

      selectable:Boolean = true
      (read,write)

      Determines if the item renderer can be interacted with.
      To do:
      • Non-selectable items are skipped when scrolling through the list

      selected

      selected:Boolean
      (read,write)

      Set the selected state of the Button. Buttons can have two sets of mouse states, a selected and unselected. When a Button's toggle property is true the selected state will be changed when the button is clicked, however the selected state can be set using ActionScript even if the toggle property is false.

      Instance methods

      setData

      function setData (
      data:Object) : Void

      Sets data from the dataProvider to the renderer.
      Parameters:
      data:
      The data associated with this itemRenderer.

      setListData

      function setListData (
      index:Number, label:String, selected:Boolean) : Void

      Set the list data relevant to the itemRenderer. Each time the item changes, or is redrawn by the owner, the itemRenderer is updated using this method.
      Parameters:
      index :
      The index of the data the itemRenderer represents.
      label :
      The calculated label the itemRenderer should display.
      selected:
      The selected state of the itemRenderer.